package kr.pfg.pfgTracer.view.controller
{
	import display.Align;
	import display.CButton;
	
	import flash.display.Sprite;

	public class VController extends Sprite
	{
		private var bg: Sprite;
		
		private var btnClear	: CButton;
		private var btnReset	: CButton;
		private var btnSave		: CButton;
		
		public function VController()
		{
			this.init();
		}
		private function init(): void
		{
			bg = new Sprite();
			bg.graphics.beginFill( 0xFFFFFF, 0 );
			bg.graphics.drawRect( 0, 0, 10, 10 );
			bg.graphics.endFill();
			
			btnClear	= new CButton( "Clear", "common_btnBG" );
			btnReset	= new CButton( "Reset", "common_btnBG" );
			btnSave 	= new CButton( "Save", "common_btnBG" );
			
			this.setPosition();
			this.initChild();
		}
		private function setPosition(): void
		{
			btnClear.x = 6;
			btnClear.y = Align.getCenterY( bg, btnClear );
			
			btnReset.x = Align.getPosX( btnClear, 5 );
			btnReset.y = Align.getCenterY( bg, btnReset );
			
			btnSave.x = Align.getPosX( btnReset, 5 );
			btnSave.y = Align.getCenterY( bg, btnSave );
		}
		private function initChild(): void
		{
			this.addChild( bg );
			
			this.addChild( btnClear );
			this.addChild( btnReset );
			this.addChild( btnSave );
		}
		
		override public function set width(value:Number):void
		{
			bg.width = value;
			
			this.setPosition();
		}
		override public function set height(value:Number):void
		{
			bg.height = value;
			
			this.setPosition();
		}
	}
}